cat <<EOT > /etc/apt/preferences.d/egl
Package: libegl1-mesa-dev
Pin: release o=Debian
Pin-Priority: -1

Package: libgl1-mesa-dev
Pin: release o=Debian
Pin-Priority: -1
EOT
apt-get update
apt-get -y install cpufrequtils locales makedev lsof rsync fake-hwclock upower ntp build-essential autoconf git libtool libtool-bin automake checkinstall libx11-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-tools libgstreamer-plugins-base1.0-dev gstreamer1.0-alsa
wget http://sources.openbricks.org/3.1/imx-vpu-3.10.17-1.0.0_beta.tar.bz2
tar -xjf imx-vpu-3.10.17-1.0.0_beta.tar.bz2
rm imx-vpu-3.10.17-1.0.0_beta.tar.bz2
cd imx-vpu-3.10.17-1.0.0_beta
make PLATFORM=IMX6Q
make install
cd ..
rm -Rf imx-vpu-3.10.17-1.0.0_beta
wget http://sources.openbricks.org/3.1/libfslvpuwrap-1.0.45.tar.bz2
tar -xjf libfslvpuwrap-1.0.45.tar.bz2
rm libfslvpuwrap-1.0.45.tar.bz2
cd libfslvpuwrap-1.0.45
./autogen.sh
make
make install
cd ..
rm -Rf libfslvpuwrap-1.0.45
wget http://sources.openbricks.org/3.1/gpu-viv-bin-mx6q-3.10.17-1.0.0-beta-sfp%2bhfp.tar.bz2
tar -xjf gpu-viv-bin-mx6q-3.10.17-1.0.0-beta-sfp+hfp.tar.bz2
rm gpu-viv-bin-mx6q-3.10.17-1.0.0-beta-sfp+hfp.tar.bz2
cd gpu-viv-bin-mx6q-3.10.17-1.0.0-beta-sfp+hfp
cp -ar hfp/usr/* /usr/local/
cd ..
rm -Rf gpu-viv-bin-mx6q-3.10.17-1.0.0-beta-sfp+hfp
ldconfig
git clone git://github.com/Freescale/gstreamer-imx.git
cd gstreamer-imx
git checkout 678a72d
sed -i "s/\/lib\/gstreamer-1.0/\/lib\/arm-linux-gnueabihf\/gstreamer-1.0/" wscript
export CFLAGS="-I /usr/local/include/imx-mm/vpu/"
./waf configure --prefix=/usr --kernel-headers=/usr/local/include --egl-platform=fb
./waf
./waf install
cd ..
rm -Rf gstreamer-imx
update-rc.d lightdm remove
cat <<EOT > /boot/uEnv.txt
mmcargs=setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=ttymxc0,115200 fbmem=128M vt.global_cursor_default=0 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 rd.dm=0 rd.luks=0 rd.lvm=0 raid=noautodetect quiet
EOT
ln -f -s /usr/local/lib/libEGL-fb.so /usr/local/lib/libEGL.so
ln -f -s /usr/local/lib/libEGL-fb.so /usr/local/lib/libEGL.so.1
ln -f -s /usr/local/lib/libEGL-fb.so /usr/local/lib/libEGL.so.1.0
ln -f -s /usr/local/lib/libEGL-fb.so /usr/local/lib/libEGL.so.1.0.0
ln -f -s /usr/local/lib/libGAL-fb.so /usr/local/lib/libGAL.so
ln -f -s /usr/local/lib/libVIVANTE-fb.so /usr/local/lib/libVIVANTE.so
mv /usr/local/lib/libEGL-x11.so /usr/local/lib/libEGL-ax11.so
mv /usr/local/lib/libEGL-wl.so /usr/local/lib/libEGL-awl.so
mv /usr/local/lib/libGAL-x11.so /usr/local/lib/libGAL-ax11.so
mv /usr/local/lib/libGAL-wl.so /usr/local/lib/libGAL-awl.so
mv /usr/local/lib/libVIVANTE-x11.so /usr/local/lib/libVIVANTE-ax11.so
mv /usr/local/lib/libVIVANTE-wl.so /usr/local/lib/libVIVANTE-awl.so
rm /usr/lib/arm-linux-gnueabihf/libEGL.so*
ldconfig
wget http://sources.openbricks.org/3.1/imx6-firmware-11.11.01.tar.bz2
tar -xjf imx6-firmware-11.11.01.tar.bz2
rm imx6-firmware-11.11.01.tar.bz2
cd imx6-firmware-11.11.01
mv firmware /lib/firmware
cd ..
rm -Rf imx6-firmware-11.11.01
cat <<EOT > /etc/udev/rules.d/99-imx.rules
KERNEL=="galcore", SUBSYSTEM=="graphics_class", GROUP="video", MODE="0660"
KERNEL=="mxc_vpu", SUBSYSTEM=="mxc_vpu", GROUP="video", MODE="0660"
KERNEL=="mxc_ipu", SUBSYSTEM=="mxc_ipu", GROUP="video", MODE="0660"
EOT
cat <<EOT > /etc/apt/preferences.d/egl
Package: libegl1-mesa-dev
Pin: release o=Debian
Pin-Priority: -1
EOT
apt-get update
apt-get -y install antlr ca-certificates-java cmake cmake-data curl default-jre default-jre-headless dh-autoreconf dh-python doxygen fontforge fontforge-common fonts-droid gawk gimp gimp-data gperf groovy ivy java-common junit4 libamd2.3.1 libantlr-java libao-common libao-dev libao4 libapache-pom-java libarchive13 libasm3-java libasn1-8-heimdal libasound2-dev libass-dev libatk-wrapper-java libatk-wrapper-java-jni libavahi-client-dev libavahi-common-dev libavcodec-dev libavfilter-dev libavfilter5 libavformat-dev libavresample-dev libavutil-dev libbabl-0.1-0 libblas-common libblas3 libbluetooth-dev libbluetooth3 libbluray-dev libbluray1 libboost-atomic1.55-dev libboost-atomic1.55.0 libboost-chrono1.55-dev libboost-chrono1.55.0 libboost-date-time1.55-dev libboost-date-time1.55.0 libboost-dev libboost-serialization1.55-dev libboost-serialization1.55.0 libboost-system1.55-dev libboost-system1.55.0 libboost-thread-dev libboost-thread1.55-dev libboost-thread1.55.0 libboost1.55-dev libbsf-java libbz2-dev libcaca-dev libcamd2.3.1 libcap-dev libccolamd2.8.0 libcdio-dev libcec-dev libcec2 libcholmod2.1.2 libclang1-3.5 libcolamd2.8.0 libcommons-cli-java libcommons-lang-java libcommons-logging-java libcommons-parent-java libcupsfilters1 libcupsimage2 libcurl3 libcurl4-gnutls-dev libcwiid-dev libcwiid1 libdbus-1-dev libdbus-glib-1-2 libdirectfb-1.2-9 libdirectfb-dev libdirectfb-extra libdrm-dev libdrm-exynos1 libdrm-omap1 libdvdnav-dev libdvdread-dev libenca-dev libexif12 libexpat1-dev libflac-dev libfontconfig1-dev libfontforge1 libfreetype6-dev libfribidi-dev libftgl-dev libftgl2 libgdraw4 libgegl-0.2-0 libgfortran3 libgif4 libgimp2.0 libgles2-mesa libglew-dev libglew1.10 libglu1-mesa-dev libgmp-dev libgmpxx4ldbl libgnutls28-dev libgnutlsxx28 libgs9 libgs9-common libgssapi3-heimdal libhamcrest-java libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libhawtjni-runtime-java libhcrypto4-heimdal libhdhomerun-dev libhdhomerun1 libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libice-dev libijs-0.35 libiso9660-8 libiso9660-dev libjansi-java libjansi-native-java libjasper-dev libjbig-dev libjbig2dec0 libjline-java libjpeg-dev libjpeg62-turbo-dev libkrb5-26-heimdal liblapack3 liblcms2-2 libldb1 liblzma-dev liblzo2-2 liblzo2-dev libmad0-dev libmicrohttpd-dev libmicrohttpd10 libmikmod-config libmikmod-dev libmikmod3 libmng1 libmockobjects-java libmodplug-dev libmp3lame-dev libmpdec2 libmpeg2-4-dev libmysqlclient-dev libmysqlclient18 libnfs-dev libnfs4 libnspr4 libnss3 libntdb1 libobjc-4.9-dev libobjc4 libogg-dev libomxil-bellagio-dev libomxil-bellagio0 libopenraw1 libp11-kit-dev libpangoxft-1.0-0 libpaper1 libpcsclite1 libplist-dev libplist2 libpng12-dev libpoppler-glib8 libpoppler46 libpostproc-dev libpostproc52 libpulse-dev libpulse-mainloop-glib0 libpython-dev libpython2.7 libpython2.7-dev libpython3-stdlib libpython3.4-minimal libpython3.4-stdlib libregexp-java libroken18-heimdal librtmp-dev libsamplerate0-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl1.2-dev libsdl1.2debian libservlet2.5-java libshairport-dev libshairport2 libsidplay2 libsidplay2-dev libslang2-dev libsm-dev libsmbclient libsmbclient-dev libspiro0 libsqlite3-dev libssh-4 libssh-dev libssl-dev libswscale-dev libtag1-dev libtalloc2 libtasn1-6-dev libtdb1 libtevent0 libtiff5-dev libtiffxx5 libtinyxml-dev libtinyxml2.6.2 libudev-dev libumfpack5.6.2 libuninameslist0 libvorbis-dev libvorbisfile3 libwayland-dev libwbclient0 libwebp-dev libwebpdemux1 libwebpmux1 libwind0-heimdal libwmf0.2-7 libx11-xcb-dev libxapian22 libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0 libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxext-dev libxfixes-dev libxft2 libxmu-dev libxmu-headers libxpm4 libxpp3-java libxrandr-dev libxrender-dev libxshmfence-dev libxslt1-dev libxslt1.1 libxstream-java libxt-dev libxxf86vm-dev libyajl-dev libyajl2 mesa-common-dev mysql-common nettle-dev openjdk-7-jre openjdk-7-jre-headless poppler-data python-cairo python-dev python-gobject-2 python-gtk2 python-imaging python-numpy python-pil python-support python-talloc python2.7-dev python3 python3-minimal python3.4 python3.4-minimal samba-libs swig swig2.0 ttf-bitstream-vera tzdata-java unzip x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xf86vidmode-dev yasm zip
git clone https://github.com/Pulse-Eight/libcec.git
cd libcec
./bootstrap
./configure --enable-tda995x
make
make install
cd ..
rm -Rf libcec
git clone https://github.com/xbmc/xbmc.git
cd xbmc
git checkout bff0ea8
./bootstrap
./configure --disable-vdpau --disable-vaapi --enable-gles --disable-pulse --disable-projectm --enable-codec=imxvpu --disable-openmax --disable-x11 --disable-xrandr --disable-gl --disable-sdl
make -j2
make install
cd ..
rm -Rf xbmc
rm /usr/lib/arm-linux-gnueabihf/libGL*
ldconfig
reboot




apt-get update && apt-get upgrade
apt-get -y install git autoconf automake libtool libltdl-dev libao-dev libavahi-compat-libdnssd-dev avahi-daemon
git clone https://github.com/juhovh/shairplay
cd shairplay
./autogen.sh
./configure
make
make install
cd ..
rm -Rf shairplay
avahi-daemon
apt-get -y --force-yes install gpu-viv-bin-fb gpu-viv-bin-fb-dev firmware-imx6 libvpu-imx6 libvpu-imx6-dev libfslvpuwrap libfslvpuwrap-dev zip swig openjdk-7-jre-headless doxygen libboost-dev python-dev libass-dev libmpeg2-4-dev libavahi-client-dev libavahi-common-dev libnfs-dev libcurl4-gnutls-dev libvorbis-dev libogg-dev libgnutls28-dev libbz2-dev libtiff5-dev liblzo2-dev libyajl-dev libgcrypt11-dev libao-dev libtinyxml-dev libxml2-dev libxvidcore4 libxslt1-dev libsqlite3-dev libpcre++-dev libtag1-dev libtagc0-dev libssh-dev libplist-dev libudev-dev libusb-dev libcap-dev libmodplug-dev autopoint
cat <<EOT > /boot/uEnv.txt
mmcargs=setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=tty1 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 rd.dm=0 rd.luks=0 rd.lvm=0 raid=noautodetect pci=nomsi ahci_imx.hotplug=1 quiet consoleblank=0 vt.global_cursor_default=0
EOT
git clone https://github.com/xbmc/xbmc.git --branch Helix
cd xbmc
apt-get -y install libjasper-dev libc-bin gawk gperf libiso9660-dev checkinstall
./bootstrap
./configure --disable-vdpau --disable-vaapi --enable-gles --disable-pulse --enable-codec=imxvpu --disable-openmax --disable-x11 --disable-xrandr --disable-gl --disable-waveform --disable-spectrum --disable-goom --disable-rsxs --disable-fishbmc --disable-projectm --disable-samba --enable-airplay --enable-airtunes --disable-upnp --disable-mysql --disable-libcec --disable-debug --disable-optical-drive --disable-texturepacker --disable-webserver
make -j2
checkinstall -D --fstrans=no --install=yes
cd ..
wget https://github.com/OpenBricks/openbricks/blob/master/packages/sound/alsa-lib/config/imx-spdif.conf
mv imx-spdif.conf /usr/share/alsa/cards/imx-spdif.conf
wget https://github.com/OpenBricks/openbricks/blob/master/packages/sound/alsa-lib/config/imx-hdmi-soc.conf
mv imx-hdmi-soc.conf /usr/share/alsa/cards/imx-hdmi-soc.conf
wget https://github.com/OpenELEC/OpenELEC.tv/blob/master/packages/sysutils/lirc/config/lircd.conf.rpi
mv /etc/lirc/lircd.conf /etc/lirc/lircd.conf.old
mv lircd.conf.rpi /etc/lirc/lircd.conf
systemctl restart lirc











export DEBIAN_FRONTEND=noninteractive
echo "deb http://packages.openmediavault.org/public kralizec main" > /etc/apt/sources.list.d/openmediavault.list
apt-get update
apt-get --yes --force-yes install openmediavault-keyring postfix locales collectd
sed -i "s/#Hostname \"localhost\"/Hostname \"localhost\"/" /etc/collectd/collectd.conf
apt-get --yes --force-yes install openmediavault
reboot

apt-get --yes --force-yes install fakeroot make debhelper lsb-release
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-omvextrasorg.git
cd openmediavault-omvextrasorg
fakeroot debian/rules binary
cd ..
dpkg -i openmediavault-omvextrasorg_1.0.5_all.deb
apt-get --yes --force-yes install mumble-server
apt-get -f install
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-mumble.git
cd openmediavault-mumble
fakeroot debian/rules binary
cd ..
dpkg -i openmediavault-mumble_1.0.0.1_all.deb

wget http://www.bozorokus.net/DynHost.tgz
tar -xvzf DynHost.tgz

-------------


export DEBIAN_FRONTEND=noninteractive
echo "deb http://packages.openmediavault.org/public kralizec main" > /etc/apt/sources.list.d/openmediavault.list
apt-get update
apt-get --yes --force-yes install openmediavault-keyring postfix locales
apt-get --yes --force-yes install collectd
sed -i "s/#Hostname \"localhost\"/Hostname \"cubox\"/" /etc/collectd/collectd.conf
apt-get --yes --force-yes install openmediavault
apt-get --yes --force-yes install lsb-release
reboot
git config --system http.sslVerify false
wget http://omv-extras.org/debian/pool/main/o/openmediavault-mumble/openmediavault-mumble_0.5.33_all.deb
apt-get --yes --force-yes install mumble-server
dpkg -i openmediavault-mumble_0.5.33_all.deb
wget http://sourceforge.net/projects/ipcheck/files/ipcheck.py
tar -xvzf DynHost.tgz
apt-get --yes --force-yes install build-essential fakeroot devscripts equivs lintian
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-omvextrasorg.git
cd openmediavault-omvextrasorg
fakeroot debian/rules binary
cd ..
dpkg -i openmediavault-omvextrasorg_1.0.5_all.deb
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-sickbeard.git
cd openmediavault-sickbeard
fakeroot debian/rules binary
cd ..
apt-get --yes --force-yes install python-cheetah
dpkg -i openmediavault-sickbeard_1.0.1_all.deb
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-couchpotato.git
cd openmediavault-couchpotato
fakeroot debian/rules binary
cd ..
dpkg -i openmediavault-couchpotato_1.0.2_all.deb
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-sabnzbd.git
cd openmediavault-sabnzbd
fakeroot debian/rules binary
cd ..
apt-get --yes -f install python-cheetah python-configobj python-feedparser par2 python-openssl python-yenc python-support unrar
apt-get -f install
apt-get --yes -f install python-cheetah python-configobj python-feedparser par2 python-openssl python-yenc python-support unrar
dpkg -i openmediavault-sabnzbd_1.0.2_all.deb
git clone git://github.com/OpenMediaVault-Plugin-Developers/openmediavault-headphones.git
cd openmediavault-headphones
fakeroot debian/rules binary
cd ..
dpkg -i openmediavault-headphones_1.0.1_all.deb
